define(["jquery","bbcare"],function($,$bb){
	var servers = {};
	var URL = $bb.baseUrl("followapp");

	/**
	 * 请求统计数据
	 */
	servers.ajaxStatistics = function(callback){
		$bb.ajax({
	        url: URL + "service/evaluation/patientDataStatistics",
	        data: JSON.stringify({
	            data: {
	                "type":"3"
	            }
	        }),
	        success: function (data) {
	            if(data.success){
					callback(data.data);
				}else{
					$bb.toastShow(data.msg ? data.msg : "请求统计数据出错！");
				}
	        },
	    });
	}

	/**
	 * 请求生长发育评估患者list
	 */
	servers.ajaxGrowthList = function(params,callback){
		$bb.ajax({
	        url: URL + "service/evaluation/patientListqry",
	        data: JSON.stringify({
	            data: params
	        }),
	        success: function (data) {
	            if(data.success){
					callback(data,params);
				}else{
					$bb.toastShow(data.msg ? data.msg : "请求统计数据出错！");
				}
	        },
	    });
	}

	/**
	 * 处理list数据
	 */
	servers.handleList = function(options){
		var list = options.list;
		for (var i = 0; i < list.length; i++) {
			if( !list[i].headCircumference ){
				list[i].headCircumference='暂无';
				list[i].headCircumferenceClassName = "monitor-null";
			}
            if( !list[i].height ){
            	list[i].height='暂无';
            	list[i].heightClassName = "monitor-null";
            }
            if( !list[i].weight ){
            	list[i].weight='暂无';
            	list[i].weightClassName = "monitor-null";
            }
			list[i].imgUrl = list[i].gender == "F" ?  "page/res/imgs/icon_girl.png" : "page/res/imgs/icon_boy.png";
		}
		if( list.length < options.rows && list.length >= 0 ){
			var remainNum = options.rows - list.length;
			for (var i = 0; i < remainNum; i++) {
				list.push({});
			}
		}
		return {"list":list};
	}

	return servers;
});